package com.why.dto;

import java.util.ArrayList;
import java.util.List;

public class Api {
    // 标题
    private String title;
    // 介绍
    private String explain;
    // url
    private String url;
    // 请求方式
    private String method;

    private List<Param> params = new ArrayList<>();
    private List<Request> requestList = new ArrayList<>();
    private List<Param> response = new ArrayList<>();

    private String requestTempleFilePath;

    public static class Request {

        private String requestClassName;
        private List<Param> requestParams = new ArrayList<>();

        public List<Param> getRequestParams() {
            return requestParams;
        }

        public void setRequestParams(List<Param> requestParams) {
            this.requestParams = requestParams;
        }

        public String getRequestClassName() {
            return requestClassName;
        }

        public void setRequestClassName(String requestClassName) {
            this.requestClassName = requestClassName;
        }

        @Override
        public String toString() {
            return "Request{" +
                    "requestClassName='" + requestClassName + '\'' +
                    ", requestParams=" + requestParams +
                    '}';
        }
    }

    public static class Param {

        // 序号
        private int no;
        // 名称
        private String name;
        // 描述
        private String description;
        // 类型
        private String type;
        // 长度
        private String length;
        // 是否可空
        private String nullAble;
        // 备注
        private String remark;

        public int getNo() {
            return no;
        }

        public void setNo(int no) {
            this.no = no;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getLength() {
            return length;
        }

        public void setLength(String length) {
            this.length = length;
        }

        public String getNullAble() {
            return nullAble;
        }

        public void setNullAble(String nullAble) {
            this.nullAble = nullAble;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        @Override
        public String toString() {
            return "Param{" +
                    "no=" + no +
                    ", name='" + name + '\'' +
                    ", description='" + description + '\'' +
                    ", type='" + type + '\'' +
                    ", length='" + length + '\'' +
                    ", nullAble='" + nullAble + '\'' +
                    ", remark='" + remark + '\'' +
                    '}';
        }
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getExplain() {
        return explain;
    }

    public void setExplain(String explain) {
        this.explain = explain;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public List<Param> getParams() {
        return params;
    }

    public void setParams(List<Param> params) {
        this.params = params;
    }

    public List<Request> getRequestList() {
        return requestList;
    }

    public void setRequestList(List<Request> requestList) {
        this.requestList = requestList;
    }

    public void addRequest(Request request) {
        requestList.add(request);
    }

    public List<Param> getResponse() {
        return response;
    }

    public void setResponse(List<Param> response) {
        this.response = response;
    }

    public String getRequestTempleFilePath() {
        return requestTempleFilePath;
    }

    public void setRequestTempleFilePath(String requestTempleFilePath) {
        this.requestTempleFilePath = requestTempleFilePath;
    }

    @Override
    public String toString() {
        return "Api{" +
                "title='" + title + '\'' +
                ", explain='" + explain + '\'' +
                ", url='" + url + '\'' +
                ", method='" + method + '\'' +
                ", params=" + params +
                ", requestList=" + requestList +
                ", response=" + response +
                ", requestTempleFilePath='" + requestTempleFilePath + '\'' +
                '}';
    }
}
